package scanner;

import java.util.HashMap;

public class SetOfKeywords
    extends HashMap<String, TokenId>
{
    public SetOfKeywords()
    {
        put("class", TokenId.CLASS);
        put("public", TokenId.PUBLIC);
        put("static", TokenId.STATIC);
        put("void", TokenId.VOID);
        put("String", TokenId.STRING);
        put("extends", TokenId.EXTENDS);
        put("return", TokenId.RETURN);
        put("int", TokenId.INT_TYPE);
        put("boolean", TokenId.BOOLEAN);
        put("if", TokenId.IF);
        put("else", TokenId.ELSE);
        put("while", TokenId.WHILE);
        put("System", TokenId.SYSTEM);
        put("out", TokenId.OUT);
        put("println", TokenId.PRINTLN);
        put("length", TokenId.LENGTH);
        put("true", TokenId.TRUE);
        put("false", TokenId.FALSE);
        put("this", TokenId.THIS);
        put("new", TokenId.NEW);
    }

    public String GetKeyword(TokenId tokenId)
    {
        String keyword = null;
        for (String str : keySet())
        {
            if (get(str) == tokenId)
            {
                keyword = str;
                break;
            }
        }
        return keyword;
    }

}
